<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Request;

class GoodsCategoryResource extends JsonResource
{
    /**
     * @param Request $request
     * @return array
     */
    public function toArray($request): array
    {
        $data = parent::toArray($request);
        $data['pic'] = strpos($data['pic'],'https') === false ? sprintf('%s%s', aliyun_domain(), $data['pic']) : $data['pic'];
        return $data;
    }
}
